<template>
	<view class="home-wrapper">
		<view class="home"  v-for="(item,index) in Activitylist" :key="index" @click="toDetails(item)" >
			<view class="home-img">
				<image :src="item.image"></image>
			</view>
			<view class="home-list">
				<image src="../../static/images/yijieshu.png" class="home-stus" v-if="time>item.end_time"></image>
				<image src="../../static/images/wei_baom.png" class="home-stus" v-if="time<item.start_time"></image>
				<image src="../../static/images/baoming_zhong.png" class="home-stus" v-if="time>item.start_time&&time<item.end_time"></image>
				<view style="font-size: 15px;color: #333333;font-weight: bold;">{{item.title}}</view>
				<view class="home-book">{{item.type}}</view>
				<view style="color: #FF5F49;" v-if="item.end_time<time">报名已结束</view>
				<view style="color: #FF5F49;" v-else>报名截止{{item.end_date}}</view>
				<view class="home-add">
					<view style="font-size: 16px;color: #FF5F49;">
						<text style="font-size: 12px;">￥</text>{{item.price}}
					</view>
					<view style="color: #999999;font-size: 12px;display: flex;flex-direction: row;align-items: center;    width: 100%;
			 justify-content: space-around;width: 70%;">
						<view style="flex:1;padding-left:10px">{{item.join_count}}人已报名</view>
						<view class="home-photo">
							<image :src="item.avatar" v-for="(item,index) in item.join_list"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<uni-load-more
		:status="loadStatus"
		></uni-load-more>

	
	</view>
</template>

<script>
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"
	//
	import msTabs from '@/components/ms-tabs/ms-tabs.vue'
	export default {
		data() {
			return {
				time:'',//当前时间
				loadStatus: 'more',
				page: 1,
			
				Activitylist:[],
				sortType: ['默认排序', '最新发布'], //排序
				sort_stic:0,//排序index
				fee_stic:0,//费用index
				sta_stic:'',//状态index
				clss_stic:'',//分类index
				feeList: ['全部', '免费', '收费'], //费用
				stuasList: ['未开始', '报名中', '已结束'], //状态
				classifyList: [] ,//分类
				feeId:0,//费用id
			    status:'',//状态id
				type:'',//type
				id_sort:'asc',//排序
				bannerList:"",
				token:"",
				tokenShow:false
			}
		},
		onLoad(){
			this.page = 1;
			this.weetlist = [];
			this.getActivityList();
		},
		onShow(){
			this.token = uni.getStorageSync('accessToken');
			// this.doHandleMonth()
		},
		components: {uniLoadMore,msTabs},
		onReachBottom () {
			if (this.loadStatus === 'more') {
				this.getActivityList()
			}
		},
		methods: {
			
			toDetails(item) {
				if(this.token==''){
					this.tokenShow = true;
				}
				if(this.token){
					let aa = item.id;
				
					uni.navigateTo({url:`/pages/find/activityInfo?address=${aa}`})
				}
			},
		
			//活动列表
			getActivityList(type) {
				const params = {
					collect: 1,
					page: this.page,

				}

				this.loadStatus = 'loading'
				this.$http.get('/activity/list', {
					params: params
				}).then((response) => {
					const res = response.data;
					console.log(res)
					if (res.code == 0) {
						if (this.page > res.data.list.last_page) {
							// 没有数据了
							this.loadStatus = 'noMore'
						} else {
							// 未加载完毕
							this.loadStatus = 'more'
							this.page++
						}
						console.log(res)
						if (type) {
							this.Activitylist = res.data.list.data
						} else {
							this.Activitylist = [...this.Activitylist, ...res.data.list.data];
							this.classifyList = res.data.type;
							this.time  = res.time;
							console.log(this.time)
						}
						this.filter = false
					} else {
						this.filter = false
					}
				})
			}
		}

	}
</script>

<style scoped>
	.swiper {
		width: 100%;
		overflow: hidden;
		height: 180px;
	}
.home-wrapper>>>.uni-load-more__text{
	margin-top: 100px;
}
	.home-wrapper>>>uni-swiper .uni-swiper-wrapper {
		z-index: 99;
	}
	.home-wrapper>>>.tabBlock .tab{
		    height: 35px;
			padding-bottom: 0 !important;
			padding-top: 5px;
	}

	.swiper .img {
		height: 180px;
		width: 100%;
	}

	.home-wrapper {
		width: 100%;
	}

	.find_benber {
		height: 180px;
		width: 100%;
	}

	.find_benber image {
		height: 100%;
		width: 100%;
	}

	.home-header {
		display: flex;
		flex-direction: row;
		background-color: #fff;
		width: 100%;
		z-index: 999;

		/*  #ifdef  H5  */
		top: 224px;
		/*  #endif  */

		/*  #ifdef  MP-WEIXIN  */
		top: 181px;
		/*  #endif  */



	}
	.home-wrapper>>>.tabBlock{
		width: 90%;
	}

	.active {
		/* display: -webkit-box;
		display: -webkit-flex;
		-webkit-box-orient: horizontal;
		-webkit-box-direction: normal;
		-webkit-flex-direction: row; */
		/* flex-direction: row; */
		background-color: #fff;
		/* width: 83%; */
		white-space: nowrap;
		/* align-items: center; */
		position: relative;
	}
.fill-img{
	position: absolute;
	    right: 7px;
	    top: 7px;
	    background-color: #fff;
}
	.active-item {
		padding: 0 18px;
		font-size: 15px;
		color: #333333;
	}

	.home-fill image {
		width: 18px;
		height: 18px;
	}

	.home-fill {
		background: linear-gradient(83deg, rgba(238, 238, 238, 0) 0%, rgba(0, 0, 0, 0.08) 100%);
		width: 16px;
		    position: absolute;
		    right: 30px;
		    top: 0;
		    height: 35px;
	}

	.home {
		height: 115px;
		background-color: #FFFFFF;
		margin: 10px 17px;
		padding: 10px;
		border-radius: 5px;
		display: flex;
		flex-direction: row;
		align-items: center;
		position: relative;
		/* top: 32px; */
	}

	.home-img image {
		width: 95px;
		height: 95px;
	}

	.home-img {
		margin-right: 10px;
	}

	.home-add {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.home-list {
		width: 100%;
	}

	.home-book {
		height: 20px;
		border-radius: 3px;
		color: #999999;
		font-size: 10px;
		text-align: left;
		line-height: 21px;
	}

	.home-photo {
		display: flex;
		flex-direction: row;
	}

	.home-photo image {

		/*  #ifdef  H5  */
		width: 25px;
		height: 25px;
		/*  #endif  */

		/*  #ifdef  MP-WEIXIN */
		width: 20px;
		height: 20px;
		/*  #endif  */

		border-style: solid;
		border-color: #fff;
		border-radius: 50%;
		margin: 0px -40upx;
	}

	.home-stus {
		width: 39px;
		height: 39px;
		position: absolute;
		right: 0;
		top: 0;
	}

	.screen {
		height: 70%;
		background-color: #fff;
		position: fixed;
		/*  #ifdef  H5 */
		top: 223px;
		/*  #endif  */

		/*  #ifdef  MP-WEIXIN */
		bottom: 0px;
		/*  #endif  */

		width: 100%;
		display: flex;
		flex-direction: column;
		z-index: 99;
	}
 /* 定义滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  background-color: rgba(240, 240, 240, 1);
}
::-webkit-scrollbar-track {
  box-shadow: inset 0 0 0px rgba(240, 240, 240, .5);
  border-radius: 10px;
  background-color: rgba(240, 240, 240, .5);
}
	.screen-text {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
	}

	.screen-con {
		width: 31%;
		height: 34px;
		border-radius: 5px;
		border: 1px solid #E7E7E7;
		font-size: 15px;
		line-height: 34px;
		text-align: center;
		color: #333333;
		margin-top: 9px;
		margin-right: 14upx;
	}

	.screen-title {
		padding: 14px 0 0;
		font-size: 14px;
	}

	.search-no {
		width: 50%;
		height: 44px;
		background: rgba(219, 219, 219, 1);
		text-align: center;
		line-height: 44px;
		font-size: 15px;
		color: #fff;
	}




</style>
